// import type{App} from 'vue'
// import {useUserInfoStore} from '@/stores/userInfo'

// export default (app:App)=>{
//     const userInfoStore = useUserInfoStore()
//     app.directive('has',{
//         mounted (el, binding){
//             // 这会在 `mounted` 和 `updated` 时都调用
//             let isExs = userInfoStore.userInfo.buttons.includes(binding.value)
//             if(!isExs){
//                 el.parentNode.removeChild(el)
//             }
//         }
//     })
// }



import type{App} from 'vue'
import {useUserInfoStore} from '@/stores/userInfo'

export default (app:App)=>{
    const userInfoStore = useUserInfoStore()
    app.directive('has',{
        mounted(ele,bindings){
            let isExs = userInfoStore.userInfo.buttons.includes(bindings.value)
            if(!isExs){
                ele.parentNode.removeChild(ele)
            }
        }
    })
}